#!/bin/sh
#-- set var ---------
export ORACLE_SID=PROD
export ORACLE_HOME=/oracle/app/oracle/product/10.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
SPOOL_FILE=/home/oracle/scripts/spool_tmp.txt
CUN_LOG=/home/oracle/log/concurrent.log
SQL_FILE=/home/oracle/scripts/concurrent.sql

#-----get concurrent info -----------
sqlplus /nolog<< EOF
conn / as sysdba
set echo off
set serveroutput off
spool $SPOOL_FILE
@${SQL_FILE}
spool off
@/home/oracle/scripts/monitor_resource_limit.sql
exit
EOF

#-----format the output ----------
echo "-------------------------------------------------------" >> ${CUN_LOG}
echo "-------------------------------------------------------" >> ${CUN_LOG}
cat $SPOOL_FILE|grep -v "SQL>" >>${CUN_LOG}
rm $SPOOL_FILE
